package com.snd.myfirstpro.voice_scheduling_platform.controller;

import com.snd.myfirstpro.voice_scheduling_platform.common.Result;
import com.snd.myfirstpro.voice_scheduling_platform.common.StatusCode;
import com.snd.myfirstpro.voice_scheduling_platform.entity.Room;
import com.snd.myfirstpro.voice_scheduling_platform.service.RoomServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/v1/voice/room")
public class RoomController {
    @Autowired
    private RoomServiceImpl roomService;

    @PostMapping("/add")
    public Result addRoom(@RequestBody Room room){
        roomService.addRoom(room);
        return new Result(true,StatusCode.OK,"新增分组成功！");
    }

    @GetMapping("/get")
    public Result<List<Room>> getAllRoom(){
        List<Room> roomList = roomService.getRoomList();
        return new Result(true,StatusCode.OK,"获取分组成功",roomList);
    }
}
